package com.carambatv.android.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.carambatv.android.R;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;

public class Ads extends Fragment {

	private View mRootView;
	private LinearLayout layout;
	public static final String ADS_ID = "a14f5266eb813cb";

	public Ads() {
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}
	
	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		mRootView = inflater.inflate(R.layout.ads, container);
		layout = (LinearLayout) mRootView.findViewById(R.id.ads_layout);
		return mRootView;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		AdView adView = new AdView(getActivity(), AdSize.BANNER, ADS_ID);
		layout.addView(adView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1));
		AdRequest request = new AdRequest();
		// request.setTesting(true);
		adView.loadAd(request);
	}

}
